<?php
if (isset($breadcrumb) && !empty($breadcrumb)) :
	echo $this->element('breadcrumb');
endif;
?>
<div class="pad group">
	<div class="post-list group">
		<div class="lbl-category pad">
			<p><?php echo $cat_name?></p>
		</div>
		<div class="group-content faqs">
			<h4 class="blue"><i class="fa fa-edit"></i> Gửi câu hỏi cho Công Chứng Âu Lạc </h4>
			<form class="send-question" accept-charset="utf-8" method="post" action="/hoi-dap/gui-cau-hoi">
				<table class="table table-striped table-bordered table-hover" id="dataTables-example">
					<tr>
						<th width="20%">Họ và tên <span class="require red"> *</span></th>
						<td>
							<?php
							echo $this->Form->input('name', array(
									'type' => 'text',
									'label' => false,
									'class' => 'form-control w400',
									'required' => true,
							));
							?>
						</td>
					</tr>
					<tr>
						<th width="20%">Email <span class="require red"> *</span></th>
						<td>
							<?php
							echo $this->Form->input('email', array(
									'type' => 'email',
									'label' => false,
									'class' => 'form-control w400',
									'required' => true,
							));
							?>
						</td>
					</tr>
					<tr>
						<th width="20%">Câu hỏi <span class="require red"> *</span></th>
						<td>
							<?php
								echo $this->Form->textarea('question', array(
									'label' => false,
									'required' => true,
									'rows'=> 4,
									'cols' => 70,
								));
							?>
						</td>
					</tr>
					<tr>
						<th width="20%">Mã bảo mật <span class="require red"> *</span></th>
						<td>
							<?php echo $this->Captcha->input();?>
							<?php echo $this->Session->flash();?>
						</td>
					</tr>
					<tr>
						<th>&nbsp;</th>
						<td>
							<div class="form-group">
							<?php
							echo $this->Form->hidden('iCat', array('value' => $this->request->params['cat_id']));
							echo $this->Form->hidden('cRewrite', array('value' => $this->request->params['cat_rewrite']));

							echo $this->Form->hidden('cpRewrite', array('value' => isset($this->request->params['cat_parent_rewrite']) ? $this->request->params['cat_parent_rewrite'] : ''));
							echo $this->Form->button('Gửi câu hỏi', array(
									'type' => 'submit',
									'class' => 'btn btn-primary',
									'label' => false,
									'div' => false,
								)
							).'  ';

							echo $this->Form->button('Làm lại', array(
									'type' => 'reset',
									'class' => 'btn btn-primary',
									'label' => false,
									'div' => false,
								)
							);
							?>
							</div>
						</td>
					</tr>
				</table>
			</form>

			<h4 class="blue"><i class="fa fa-th-list"></i> Danh sách hỏi đáp </h4>
		<?php
		if(isset($list_news) && !empty($list_news)):
			$total = count($list_news);
			foreach ($list_news as $key => $news):
				$key++;
				$linkDetail = $this->Html->url(
						array(
								'controller' => 'news',
								'action' => 'detail',
								'cat_rewrite' => $news['Category']['cat_rewrite'],
								'news_id' => $news['Faqs']['id'],
								'news_rewrite' => $news['Faqs']['question_rewrite'],
								'ext' => 'html',
						)
				);
		?>
			<article class="item-list">
				<div class="sender-name">
					Bạn <strong><?php echo $news['Faqs']['name'];?></strong> gửi câu hỏi lúc <?php echo date('H:i:s | Y-m-d', $news['Faqs']['last_update'])?>:
				</div>
				<div class="post-box-title">
					<?php echo $this->Common->cutstr($news['Faqs']['question'], 400, true);?>
				</div><!--/.post-title-->
				<div class="lbl-answer blue">Công Chứng Âu Lạc trả lời: </div>
				<div class="entry-faq">
					<p><?php echo $this->Common->cutstr($news['Faqs']['answer'], 400, true);?></p>
					<div class="detail"><a href="<?php echo $linkDetail;?>"><i class="fa fa-hand-o-right"></i> Xem tiếp</a></div>
				</div><!--/.entry-->
				<div class="clear"></div>
			</article>
		<?php
			endforeach;
		endif;
		?>
		</div>
	</div>
</div>
<?php if($this->Paginator->param('count') > $page_number_limit):?>
<div id="dataTables-example_paginate" class="dataTables_paginate paging_simple_numbers">
	<ul class="pagination flRight box25">
		<?php
// 			$this->Paginator->options(array(
// 					'url'=> array(
// 							'controller' => 'categorys',
// 							'action' => 'index'
// 					)));
			echo $this->Paginator->prev(__('Previous'), array(
				'class' => 'previous',
				'tag' => 'li',
				'disabledTag' => 'a'
			));

			echo $this->Paginator->numbers(array(
				'separator' => '    ',
				'tag' => 'li',
				'currentClass' => 'active',
				'currentTag' => 'a'
			));

			echo $this->Paginator->next(__('Next'), array(
				'class' => 'next',
				'tag' => 'li',
				'disabledTag' =>'a'
			));
		?>
	</ul>
</div>
<?php endif;?>

